import type {
  AxiosRequestConfig,
  AxiosResponse,
  InternalAxiosRequestConfig
} from 'axios'

export interface AppInterceptors<T = AxiosResponse> {
  // 请求拦截
  requestInterceptors?: (
    config: AxiosRequestConfig
  ) => InternalAxiosRequestConfig<any>
  requestInterceptorsCatch?: (err: any) => any
  // 响应拦截
  responseInterceptors?: (res: T) => T
  responseInterceptorsCatch?: (err: any) => any
}

// 自定义传入参数
export interface AppAxiosConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?: AppInterceptors<T>
}
